package com.pucong.gitee.database.backup.configuration.schedule;

import com.pucong.gitee.database.backup.business.sys.service.GetLogFileContentService;
import com.pucong.gitee.database.backup.business.sys.service.SysFileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
public class LogSchedule {


	@Autowired
	private SysFileService sysFileService;

	@Autowired
	private GetLogFileContentService getLogFileContentService;

	/**
	 * 每月1日删除临时文件
	 */
	@Scheduled(cron = "0 0 1 1 * ?")
    public void cron() {
		// 删除临时文件
		sysFileService.deleteTmpFile();
		// 删除日志文件
		getLogFileContentService.deleteLogFile();
    }
}
